var app = getApp();
var util = require("../../utils/libs.js")
var api = require("../../utils/api.js")
var data = require("../../utils/date.js") 

Page({
  data: {
     skillList:[],
     page:0,
     limit:10,
     id:"",
     uid:""
  },
  onLoad (options) {
    let that = this
    // 页面初始化 options为页面跳转所带来的参数
    that.gettopicArticleList()
  },
  gettopicArticleList(){
    let that =this
    util.request(api.topicList,{
     page:1,
     limit:99999
    },"GET")
    .then(function (res) {
      if(res.error_code === 0){
        var arr=res.data.list
        arr.forEach(val => {
            val.create_time = data.data(val.create_time)
        });
        res.data.list.forEach(item =>{
          let content = item.description.substring(0,60);
            item.content = content+"……";
            item.imgUrl = ''
        });
         that.setData({
          skillList:res.data.list
         })
      }
    })
  },
  goDetail(e){
  let id = e.currentTarget.dataset.id
  wx.navigateTo({
    url:"/pages/writing/writing?id="+id
  })
  },
  onReady () {
    // 页面渲染完成
  },
  onShow () {
    // 页面显示
  },
  onHide () {
    // 页面隐藏

  },
  onUnload () {
    // 页面关闭

  }
})
